home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 43 / Amiga Format CD43 (1999)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1999-09].iso / -serious- / archivers / xpk / xpk_source / include / sdi_defines.h < prev   
C/C++ Source or Header  |  1999-06-14  |  3KB  |  123 lines

  1. #ifndef SDI_DEFINES_H
  2. #define SDI_DEFINES_H
  3.  
  4. /* Includeheader
  5.  
  6.     Name:        SDI_defines
  7.     Versionstring:    $VER: SDI_defines.h 1.29 (01.09.1998)
  8.     Author:        SDI
  9.     Distribution:    PD
  10.     Description:    standard defines and macros and version string
  11.  
  12.  1.17  12.06.96 : RETURN_WARN instead of RETURN_ERROR in SDI_ENDCODE
  13.  1.18  06.07.96 : End: PrintFault behind end --> allows selecting output
  14.  1.19  21.08.96 : added __SASC __AMIGADATE__ support
  15.  1.20  24.08.96 : better SAS-C support
  16.  1.21  04.09.96 : changed error with SAS date having the brackets already
  17.  1.22  18.11.96 : converted to english, C++ comments to C ones
  18.  1.23  02.01.97 : corrected some stuff
  19.  1.24  17.03.97 : removed GetChar and other obsolete defines
  20.  1.25  08.10.97 : renamed defines, removed some defines
  21.  1.26  10.02.98 : made version string const
  22.  1.27  20.02.98 : added compiler independence stuff
  23.  1.28  25.06.98 : compiler independent stuff moved to SDI_compiler.h
  24.  1.29  01.09.98 : fixes for StormC Demo
  25. */
  26.  
  27. #include <exec/types.h>
  28.  
  29. /* ========================= useable defines ============================ */
  30.  
  31. /*
  32.   SDI_ENDCODE        turn on generation of End function
  33.   SDI_ENDCODE_NOCTRLC    use End generation without CTRL_C check
  34.  
  35.   AUTHOR    program author - default is "by SDI"
  36.   DATE        programm creation date - default is automatically created
  37.   DISTRIBUTION    distribution form - default is "(PD) "
  38.   REVISION    revision number - default is "0"
  39.   VERSION    version number - default is "1"
  40. */
  41.  
  42. /* ======================= no need for <stdlib.h> ======================= */
  43.  
  44. #ifdef __cplusplus
  45.   extern "C"
  46. #endif
  47. extern void exit(int);
  48.  
  49. /* ============================ other macros ============================ */
  50.  
  51. /* <proto/exec.h>, <dos/dos.h> */
  52.  
  53. #define CTRL_C        (SetSignal(0L,0L) & SIGBREAKF_CTRL_C)
  54.  
  55. /* ================================= SAS C ============================== */
  56.  
  57. #define TestOS if(DOSBase->dl_lib.lib_Version < DosVersion)    \
  58.              exit(RETURN_FAIL)
  59.  
  60. /* A word about variable DosVersion: In my startup code for MaxonC++ I
  61. include use OpenLibrary("dos.library", DosVersion) instead of standard
  62. OpenLibrary("dos.library",0) call. If no DosVersion is given, this
  63. variable defaults to 33, else you can give the value by creating a global
  64. variable ULONG DosVersion = 37;. The program does not start, when the
  65. required DOS is not available. (Better then others, which crash) */
  66.  
  67. /* ===================== version string and EndCode ===================== */
  68.  
  69.  
  70. #ifdef NAME
  71.   #ifndef AUTHOR
  72.     #define AUTHOR "by SDI"
  73.   #endif
  74.   #ifndef VERSION
  75.     #define VERSION "1"
  76.   #endif
  77.   #ifndef REVISION
  78.     #define REVISION "0"
  79.   #endif
  80.   #ifndef DATE
  81.     #if defined(__MAXON__) || defined(__STORM__)
  82.       #define SDI_DATE "(" __DATE2__ ")"
  83.     #elif defined(__SASC)
  84.       #define SDI_DATE __AMIGADATE__
  85.     #elif defined(__GNUC__)
  86.       #define SDI_DATE "(" __DATE__ ")"
  87.     #endif
  88.   #else
  89.     #define SDI_DATE "(" DATE ")"
  90.   #endif
  91.  
  92.   #ifndef DISTRIBUTION
  93.     #define DISTRIBUTION "(PD) "
  94.   #endif
  95.   const STRPTR version = (STRPTR) "$VER: " NAME " " VERSION "." REVISION " "
  96.   SDI_DATE " " DISTRIBUTION AUTHOR;
  97. #endif /* NAME */
  98.  
  99. #if defined(SDI_ENDCODE) || defined(SDI_ENDCODE_NOCTRLC)
  100.   #include "SDI_compiler.h"
  101.  
  102.   INLINE void end(void);
  103.  
  104.   void End(UBYTE err)
  105.   {
  106.     #ifndef SDI_ENDCODE_NOCTRLC
  107.     if(CTRL_C)
  108.     {
  109.       err = RETURN_WARN;
  110.       SetIoErr(ERROR_BREAK);
  111.     }
  112.     #endif
  113.  
  114.     end();
  115.  
  116.     if(err)        PrintFault(IoErr(), 0);
  117.     exit(err);
  118.   }
  119. #endif /* SDI_ENDCODE && SDI_ENDCODE_NOCTRLC */
  120.  
  121. #endif /* SDI_DEFINES_H */
  122.  
  123.